SDK Updates: v3.1.0#32
Open
postman[bot] wants to merge 1 commit into
Open
Conversation
e072c81 to
0d838e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SDK updates
Changed
models/__init__.pynow use PEP 562__getattr__for lazy loading; classes are imported on first access and cached rather than eagerly loaded at module-import time, significantly reducing startup time for SDKs with large model countsFixed
model_rebuild()is batched across all eligible BaseModels after all models are loaded into the module namespaceApiErrornow properly displays the HTTP status code and message when converted to a string or printed in tracebacks (previously showed only the class path)api_key_headerparameter with a placeholder value; the SDK's default header name from the spec is now usedisAnySchemaparameters no longer crashes withNameError: name 'Any' is not definedand now honors spec-provided examplesAnyno longer crash at runtime withTypeError: typing.Any cannot be used with isinstance()ImportError: cannot import name 'Any' from <sdk>.modelshttps:///) no longer raiseValueErrorat SDK import timeFileNotFoundErrorfor missing test fixtures_FOO_) are now properly sanitizedAdded
ApiContextservice methods withkind: 'graphql', mapping field arguments tovariablesSchemaand return types to bothresponseDataSchemaand GraphQL-awareresponseEnvelopeSchemafor downstream generatorsID,String,Int,Float,Boolean) and the commonUploadextension scalar into shared schema types, with custom scalars conservatively mapping toANYwhile preserving original names intypeDefinitionfor downstream specializationQueryandMutation), ensuring stable SDK surfaces across regenerations even when the schema defines custom root type namesFixed
#/paths/~1api~1v2~1warehouses/get/responses/202) now resolve correctly instead of throwing invalid reference errorssdkConfig.inferServiceNames: falseoption now prevents service fragmentation; when disabled, all requests collapse into a single root service named aftersdkName, restoring the flat client surface for collections converted from OpenAPI specsinfield (Postman implicitly defaults toheader; SDKs were previously selecting the wrong scheme from the spec)AcceptandContent-Typeas method parameters; both are transport-layer headers managed by the SDK itself, and exposing them (especially Postman's defaultAccept: application/json) caused 406 NotAcceptable errors against endpoints with different declared response typesAcceptorContent-Typeas header parameters no longer surface them as method parameters, bringing the generator into compliance with OpenAPI 3.0 §4.7.12.1application/json; JSON examples with unparseable bodies (e.g. placeholder strings) are downgraded totext/plainto match postman2openapi's inferenceContent-Type: application/jsonheaders on multipart and urlencoded requests (common on image uploads and form submissions) now generate SDKs that send the correct content type; the generator now followsbody.modeinstead of request-level headers for these casesinstance: 'instance (Instance name)',endpoint: 'https://api.example.com (Domain of your API)') now generate SDKs with correct URLs and method signatures; the postman-mapper strips trailing(description)annotations, drops self-referential placeholder values that would otherwise inline as constant URL segments instead of path parameters, and defensively coerces non-string variable values (numbers, booleans, null)Security
homepage, authorname/email) are now sanitized at the config ingestion chokepoint to prevent template injection through generated build manifests; literal break-out characters (quotes, backticks, braces, angle-brackets, backslash) are stripped while ordinary prose (URLs, descriptive sentences, names with punctuation) is preserved